﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RootfusAddinAddinSideAdapters
{
    class UtilityConverters
    {
        internal static RootfusAddinView.ROOTObjectSpec ConvertROOTObjectSpec(RootfusAddinContracts.ROOTObjectSpec rtn)
        {
            if (rtn == null)
            {
                return null;
            }
            RootfusAddinView.ROOTObjectSpec me = new RootfusAddinView.ROOTObjectSpec();
            me._native_pointer = rtn._native_pointer;
            me._class_name = rtn._class_name;
            return me;
        }

        internal static RootfusAddinContracts.ROOTObjectSpec ConvertROOTObjectSpec(RootfusAddinView.ROOTObjectSpec rtn)
        {
            if (rtn == null)
            {
                return null;
            }
            RootfusAddinContracts.ROOTObjectSpec me = new RootfusAddinContracts.ROOTObjectSpec();
            me._class_name = rtn._class_name;
            me._native_pointer = rtn._native_pointer;
            return me;
        }
        internal static RootfusAddinView.ROOTObjectSpec[] ConvertROOTObjectSpecArray(RootfusAddinContracts.ROOTObjectSpec[] rtn)
        {
            if (rtn == null)
            {
                return null;
            }

            RootfusAddinView.ROOTObjectSpec[] result = new RootfusAddinView.ROOTObjectSpec[rtn.Length];
            int index = 0;
            foreach (var item in rtn)
            {
                result[index] = ConvertROOTObjectSpec(item);
                index += 1;
            }

            return result;
        }

        internal static RootfusAddinContracts.ROOTObjectSpec[] ConvertROOTObjectSpecArray(RootfusAddinView.ROOTObjectSpec[] rtn)
        {
            if (rtn == null)
            {
                return null;
            }
            int index = 0;
            RootfusAddinContracts.ROOTObjectSpec[] result = new RootfusAddinContracts.ROOTObjectSpec[rtn.Length];
            foreach (var item in rtn)
            {
                result[index] = ConvertROOTObjectSpec(item);
                index += 1;
            }
            return result;
        }
    }
}
